var wc = require("../components/winLocation.js")
var token, loginName, openid, loginType, mer_id, fromPage;

$(document).on("pageinit", "#success_page", controllerInit);

function controllerInit() {
    wc.checkBrowser();
    wc.QueryString.Initial();
    initValue();
    var money = wc.QueryString.GetValue("money");

    //    $("#moneyValue").text("money");
    $("#fanhui").on("touchstart", function() {
        location.href = "./spending.html?lastPage=" + fromPage;
    });

    $("#closePage").on("touchstart", function() {
        if (fromPage == "merchant") {
            location.href = "./merchantHome.html";
        } else {
            location.href = "./staffHome.html";
        }
    });
}

// 初始化变量
function initValue() {
    fromPage = wc.QueryString.GetValue("fromPage");
    getSessionStorage();
}

// 取本地存储essionStorage
function getSessionStorage() {
    token = sessionStorage.getItem("tltd_token");
    loginName = sessionStorage.getItem("tltd_loginName");
    openid = sessionStorage.getItem("tltd_openid");
    loginType = sessionStorage.getItem("tltd_loginType");
    mer_id = sessionStorage.getItem("mer_id");
    //    mer_no = sessionStorage.getItem("mer_no")
    console.log(token, loginName, openid, loginType);
}